# Maintainer: ImperatorS79 <fevrier.simon@gmail.com>

_realname=sol2
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.2.2
pkgrel=1
pkgdesc="sol2 is a C++ library binding to Lua"
arch=('any')
url="https://sol2.readthedocs.io/"
license=("MIT")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-ninja")
depends=("${MINGW_PACKAGE_PREFIX}-lua")
source=(https://github.com/ThePhD/sol2/archive/v${pkgver}.tar.gz)
sha256sums=('141790dae0c1821dd2dbac3595433de49ba72545845efc3ec7d88de8b0a3b2da')

prepare() {
  plain 'No Step'
}

build() {
  cd "${srcdir}/sol2-${pkgver}"
  rm -rf buid && mkdir build && cd build

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
      -GNinja \
      -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
	  ..
  
  ${MINGW_PREFIX}/bin/cmake --build . 
}

package() {
  cd "${srcdir}/sol2-${pkgver}/build"
  DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake --build . --target install
}
